package models

import (
	"sale-admin/internal/app/web/schema"
	"time"
)

// MaGoodsMulti [...]
type MaGoodsMulti struct {
	ID                 string                 `gorm:"autoIncrement:true;primaryKey;column:id;type:int;not null"  json:"id" json_old:"ID"`
	GoodsName          string                 `gorm:"column:goods_name;type:varchar(250);not null;comment:商品名称"  json:"goods_name" json_old:"GoodsName"`
	MultiGoods         string                 `gorm:"column:multi_goods;type:text;not null;comment:多规格商品"  json:"-" json_old:"MultiGoods"`
	MultiGoodsFormated []schema.MultiGoodsNew `gorm:"-" json:"multi_goods"`
	GoodsDetail        string                 `gorm:"column:goods_detail;type:text;not null;comment:商品详情"  json:"goods_detail" json_old:"GoodsDetail"`
	SalesID            string                 `gorm:"column:sales_id;type:varchar(128);not null;comment:机器识别码"  json:"sales_id" json_old:"SalesID"`
	RobotName          string                 `gorm:"column:robot_name;type:varchar(128);not null;comment:机器名称"  json:"robot_name" json_old:"RobotName"`
	AddTime            time.Time              `gorm:"column:add_time;type:datetime;not null;comment:添加时间"  json:"-" json_old:"AddTime"`
	AddTimeFormated    string                 `gorm:"-"   json:"add_time"`
	MultiSort          int                    `gorm:"column:multi_sort;type:int;default:null;comment:多商品规格排序值"  json:"multi_sort" json_old:"MultiSort"`
	CreatedAt          int64                  `gorm:"index:created_at;column:created_at;autoCreateTime;type:int;size:64;comment:创建时间" json:"created_at"`
}

// TableName get sql table name.获取数据库表名
func (m MaGoodsMulti) TableName() string {
	return "ma_goods_multi"
}

// 模式自动注册
func init() {
	Models = append(Models, &MaGoodsMulti{})
}
